from fastapi import APIRouter, Request
from app.services.analysisService import AnalysisService
from app.common.result import Result

router = APIRouter()
analysis_service = AnalysisService()

@router.get("/getAllEvents")
async def get_all_events():
    """
    获取所有事件
    """
    events = await analysis_service.get_all_events()
    return Result.success(data=events)

@router.get("/getCommentsById")
async def get_comments_by_id(e_id: int):
    """
    根据事件ID获取评论
    """
    comments = await analysis_service.get_comments_by_id(e_id)
    return Result.success(data=comments)

@router.get("/getArticlesById")
async def get_articles_by_id(e_id: int):
    """
    根据事件ID获取文章
    """
    articles = await analysis_service.get_articles_by_id(e_id)
    return Result.success(data=articles) 

@router.get("/eventAnalysisInit")
async def eventAnalysisInit(e_id: int):
    """
    事件信息初始化
    """
    event= await analysis_service.event_info_expand(e_id)
    return Result.success(data=event)